package com.px.plan.domain;

import cn.hutool.core.date.BetweenFormatter;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.px.common.annotation.Excel;
import com.px.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 飞行行动记录对象 plan_action_record
 *
 * @author WRJ
 * @date 2024-08
 */
@Data
public class PlanActionRecord extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @ApiModelProperty(value = "id")
    private Long id;

    /** 行动ID */
    @ApiModelProperty(value = "行动ID")
    @Excel(name = "行动ID")
    private Long actionId;

    /** 行动名称 */
    @ApiModelProperty(value = "行动名称")
    @Excel(name = "行动名称")
    private String actionName;

    /** 行动方案ID */
    @ApiModelProperty(value = "行动方案ID")
    @Excel(name = "行动方案ID")
    private Long schemeId;

    /** 行动方案名称 */
    @ApiModelProperty(value = "行动方案名称")
    @Excel(name = "行动方案名称")
    private String schemeName;

    /** 飞手ID */
    @ApiModelProperty(value = "飞手ID")
    @Excel(name = "飞手ID")
    private Long pilotId;

    /** 飞手名称 */
    @ApiModelProperty(value = "飞手名称")
    @Excel(name = "飞手名称")
    private String pilotName;

    /** 无人机ID */
    @ApiModelProperty(value = "无人机ID")
    @Excel(name = "无人机ID")
    private Long droneId;

    /** 无人机SN */
    @ApiModelProperty(value = "无人机SN")
    @Excel(name = "无人机SN")
    private String droneSn;

    /** 无人机名称 */
    @ApiModelProperty(value = "无人机名称")
    @Excel(name = "无人机名称")
    private String droneName;

    /** 行动状态.1:进行中,2:已结束 */
    @ApiModelProperty(value = "行动状态.1:进行中,2:已结束")
    @Excel(name = "行动状态.1:进行中,2:已结束")
    private Integer actionStatus;

    /** 开始飞行时间 */
    @ApiModelProperty(value = "开始飞行时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始飞行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date flightTimeBegin;

    /** 结束飞行时间 */
    @ApiModelProperty(value = "结束飞行时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束飞行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date flightTimeEnd;

    /** 飞行器累计飞行航时 */
    @ApiModelProperty(value = "飞行器累计飞行航时")
    @Excel(name = "飞行器累计飞行航时")
    private Long flightTime;

    /** 飞行器累计飞行里程 */
    @ApiModelProperty(value = "飞行器累计飞行里程")
    @Excel(name = "飞行器累计飞行里程")
    private Integer flightDistance;

    /** 行动记录 */
    @ApiModelProperty(value = "行动记录")
    @Excel(name = "行动记录")
    private String content;

    /** 创建人所属部门ID */
    @ApiModelProperty(value = "创建人所属部门ID")
    @Excel(name = "创建人所属部门ID")
    private Long deptId;

    private String flightTimeStr;

    private long mediaSize;

    public String getFlightTimeStr(){
        if (null != flightTime) {
            long secs = flightTime * 1000;
            return DateUtil.formatBetween(secs, BetweenFormatter.Level.SECOND);
        }
        return flightTime + "";
    }

}
